package com.jsmile.cloud.msgcenter.web.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import com.alibaba.fastjson.JSONObject;

import lombok.Data;

@Configuration
@ConfigurationProperties(prefix = "jsmile.msg")
@Data
public class MsgConfig {

    /**
     * 短信模板（json格式）
     */
    private JSONObject smsTemplates;
    private JSONObject smsSignNames;
    private Integer smsSendMaxCount;

    /**
     * 百度ocr识别密钥
     */
    private String baiduAppId;
    private String baiduApiKey;
    private String baiduSecretKey;

    public String getSignNamesByTenantId(String tenantId) {
        return smsSignNames.getString(tenantId);
    }

    /**
     * 获取短信发送模板
     *
     * @param value
     *            短信枚举
     * @return 短信发送模板
     */
    public String getSmsTemplatesCode(String tenantId, String value) {
        return smsTemplates.getJSONObject(tenantId).getString(value);
    }

}
